package com.car.dal.dao.user;

import java.util.List;

import com.car.dal.dao.ibatis.IbatisCommonDao;
import com.car.dal.object.Teacher;
import com.car.dal.object.TgOffice;
import com.car.dal.object.TgUser;
import com.car.dal.object.TgUserinfo;
import com.car.util.Page;

public class UserinfoDaoImpl extends IbatisCommonDao<TgUserinfo, Long> implements UserinfoDao {
	
	public Integer getUserInfoCount(TgUserinfo userinfo) {
		Integer total=this.queryForInteger("getUserInfoCount", userinfo);
		return total;
	}

	public List<TgUserinfo> getUserInfoByUserName(TgUserinfo userinfo,Page page) {
		userinfo.setFirstrownum(page.getFirstrownum());
		userinfo.setPagesize(page.getPagesize());
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getUserInfoByUserName", userinfo);
		return list;
	}
	
	public List<TgUserinfo> getUserInfoByUserInfo(TgUserinfo userinfo) {
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getUserInfoByUserInfo", userinfo);
		return list;
	}
	public List<TgUserinfo> getUserInfoByUserInfo2(TgUserinfo userinfo) {
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getUserInfoByUserInfo2", userinfo);
		return list;
	}
	
	public List<TgUserinfo> getReseUser(TgUserinfo userinfo) {
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getReseUser", userinfo);
		return list;
	}
	
	public List<TgUserinfo> getUserInfoByListState(TgUserinfo userinfo) {
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getUserInfoByListState", userinfo);
		return list;
	}
	
	public List<TgUserinfo> getUserlistByType(TgUserinfo userinfo) {
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getUserlistByType", userinfo);
		return list;
	}
	
	public Integer getUsernameCont(TgUserinfo userinfo) {
		return this.queryForInteger("getUsernameCont", userinfo);
	}
	
	public List<TgUserinfo> getUserInfoUsername(TgUserinfo userinfo,Page page) {
		userinfo.setFirstrownum(page.getFirstrownum());
		userinfo.setPagesize(page.getPagesize());
		List<TgUserinfo> list=this.queryForEntityList(TgUserinfo.class,"getUserInfoUsername", userinfo);
		return list;
	}

	@Override
	public List<TgUserinfo> getzxNotZhuanz(TgUserinfo userinfo) {
		List<TgUserinfo> list = this.queryForEntityList(TgUserinfo.class, "getzxNotZhuanz", userinfo);
		return list;
	}

	@Override
	public List<TgUserinfo> getKeChengGuWen(TgUserinfo userinfo) {
		List<TgUserinfo> list = this.queryForEntityList(TgUserinfo.class, "getKeChengGuWen", userinfo);
		return list;
	}

	@Override
	public List<TgUserinfo> getUserInfoByUserInfo3(TgUserinfo userinfo) {
		List<TgUserinfo> list = this.queryForEntityList(TgUserinfo.class, "getUserInfoByUserInfo3", userinfo);
		return list;
	}

	@Override
	public TgUserinfo getTeacherByNickName(String nickName) {
		TgUserinfo entity=new TgUserinfo();
		entity.setNickname(nickName);
		List<TgUserinfo> hasuser=super.findByExample(entity);
		if (hasuser!=null&&hasuser.size()>0) {
			return hasuser.get(0);
		}
		return null;
	}
	/**
	 * 通过城市获取课程顾问 
	 */
	@Override
	public List<TgUserinfo> getKeChengGuWen_ByCity(String city) {
		TgUserinfo userinfo = new TgUserinfo();
		userinfo.setCity(city);
		return this.queryForEntityList(TgUserinfo.class, "getKeChengGuWen_ByCity", userinfo);
	}
	

	@Override
	public List<TgUserinfo> getUserInfoByUserInfo4(TgUserinfo userinfo) {
		List<TgUserinfo> list = this.queryForEntityList(TgUserinfo.class, "getUserInfoByUserInfo4", userinfo);
		return list;
	}

	@Override
	public List<TgUserinfo> findByExample2(TgUserinfo userinfo) {
		List<TgUserinfo> list = this.queryForEntityList(TgUserinfo.class, "findByExample2keyname", userinfo);
		return list;
	}

	@Override
	public List<TgUserinfo> getUser_ByKeyName(String keyName) {
		TgUserinfo userinfo = new TgUserinfo();
		userinfo.setRegion(keyName);
		return this.findByExample(userinfo);
	}

	@Override
	public List<TgUserinfo> get_AllTeachers_ByCenter(String keyName) {
		TgUserinfo userinfo = new TgUserinfo();
		userinfo.setRegion(keyName);
		return this.queryForEntityList(TgUserinfo.class, "get_AllTeachers_ByCenter", userinfo);
	}
}
